<script setup lang="ts">
import { ref } from 'vue'
import Service from '../../mock/Service'
const props = defineProps<{ data: ProjectRaw[] }>()

const projects = ref([] as Project[]);
props.data.forEach((project) => {
    Service.getProject(project.id).then(_project => {
        if (_project == undefined)
            return;
        projects.value.push({
            ..._project, session: project.session
        })
    })
});
</script>

<template>
    <div v-for="project in projects">
        <div style="display: block; height: 30px;">
            <div style="float: left; font-weight: bold;">{{ project.name }}</div>
            <div
                style="float: right;"
            >{{ project.session[0] }}——{{ project.session[1] == '' ? "至今" : project.session[1] }}</div>
        </div>
        <div>{{ project.description }}</div>
    </div>
</template>